package service;

import dao.workdao.querysubmitDao;
import dao.workdao.querysubmitDaoImpl;
import model.submitState;

public class querysubmitService {

	public submitState querysubmitState(int work_id,String schoolyear) {
		submitState state=new submitState();
		int totalstudent = 0;
		int submitcount = 0;
		state.setWork_id(work_id);
		querysubmitDao qsd=new querysubmitDaoImpl();
		try {
			totalstudent=qsd.queryStudentCount(schoolyear);
		} catch (Exception e) {
			e.printStackTrace();
		}
		try {
			submitcount=qsd.querysubmitted(work_id);
		} catch (Exception e) {
			e.printStackTrace();
		}
		state.setTotalstudent(totalstudent);
		state.setSubmitcount(submitcount);
		state.setUnsubmitcount(totalstudent-submitcount);
		return state;
	}

}
